using System;
using System.Collections.Generic;
using System.Text;

namespace GPSCore
{
    #region DilutionOfPrecisionRating

    /// <summary>
    /// DilutionOfPrecision Rating
    /// </summary>
    public enum DilutionOfPrecisionRating
    {
        /// <summary>
        /// Excellent
        /// </summary>
        Excellent = 3,
        /// <summary>
        /// Fair
        /// </summary>
        Fair = 20,
        /// <summary>
        /// Good
        /// </summary>
        Good = 6,
        /// <summary>
        /// Ideal
        /// </summary>
        Ideal = 1,
        /// <summary>
        /// Moderate
        /// </summary>
        Moderate = 8,
        /// <summary>
        /// Poor
        /// </summary>
        Poor = 50,
        /// <summary>
        /// Unknown
        /// </summary>
        Unknown = 0
    }
    
    #endregion

    #region DilutionOfPrecision

    /// <summary>
    /// Dilution Of Precision
    /// </summary>
    public class DilutionOfPrecision
    {
        #region members

        private double _horizzontal;

        private double _vertical;

        private double _positional;

        #endregion

        #region constructors

        /// <summary>
        /// Dilution Of Precision
        /// </summary>
        public DilutionOfPrecision()
        {
 
        }

        #endregion

        #region properties

        /// <summary>
        /// Dilution Of Precision Rating
        /// </summary>
        /// <param name="value"></param>
        public DilutionOfPrecisionRating Rating( double value )
        {
            double num = Math.Floor( value );
            if (num < 0)
            {
                return DilutionOfPrecisionRating.Unknown;
            }
            if ((num == 1) || ((num == 0) && ( value > 0)))
            {
                return DilutionOfPrecisionRating.Ideal;
            }
            if (num <= 3)
            {
                return DilutionOfPrecisionRating.Excellent;
            }
            if (num <= 6)
            {
                return DilutionOfPrecisionRating.Good;
            }
            if (num <= 8)
            {
                return DilutionOfPrecisionRating.Moderate;
            }
            if (num <= 20)
            {
                return DilutionOfPrecisionRating.Fair;
            }
            return DilutionOfPrecisionRating.Poor;
        }

        /// <summary>
        /// Horizzontal
        /// </summary>
        public double Horizzontal
        {
            get { return _horizzontal; }
            set { _horizzontal = value; }
        }

        /// <summary>
        /// Vertical
        /// </summary>
        public double Vertical
        {
            get { return _vertical; }
            set { _vertical = value; }
        }

        /// <summary>
        /// Positional
        /// </summary>
        public double Positional
        {
            get { return _positional; }
            set { _positional = value; }
        }

        #endregion
    }
    
    #endregion
}
